package Solution201_220;

public class Solution204 {
    public int countPrimes(int n) {
        boolean[] isPrime = new boolean[n + 1];
        int count = 0;
        for (int i = 2; i < n; i++) {
            if (!isPrime[i]) {
                count++;
                for (int j = 2; i * j < n; j++) {
                    isPrime[j * i] = true;
                }
            }

        }
        return count;
    }
}
